package com.xizi.lotterySystem.common.exception;

import com.xizi.lotterySystem.common.exception.errorCode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=true)
public class ServiceException extends RuntimeException{
    private Integer code;
    private String message;

    public ServiceException(){
    }

    public ServiceException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ServiceException(ErrorCode errorCode){
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }
}
